package com.gpjcjl.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.gpjcjl.R;
import com.gpjcjl.entity.Produce;
import com.gpjcjl.entity.Property;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

/**
 * 产权单位适配器
 *
 * @author yinbiao
 * @date 2020-10-26 09:28:37
 */
public class PropertyAdapter extends BaseRecyclerAdapter<Property> {

    public PropertyAdapter(Context context, List<Property> datas) {
        super(context, R.layout.item_company, datas);
    }

    @Override
    protected void convert(ViewHolder holder, Property property, int position) {
        holder.setText(R.id.tv, property.getProperty());
    }

    public void filter(String keywords) {
        for (int i = mDatas.size() - 1; i >= 0; i--) {
            String name = mDatas.get(i).getProperty();
            if (TextUtils.isEmpty(name) || !name.contains(keywords)) {
                mDatas.remove(i);
            }
        }
        notifyDataSetChanged();
    }

}

